# -*- coding: utf-8 -*-
# @Time : 2021/05/18
# @Author : ricky
# @File : ruoyifastconstant.py
# @Software: vscode
"""
若依单体应用版本（RuoYi-fast）常量
"""
import sys


class _const:
    # 自定义异常处理
    class ConstError(PermissionError):
        pass

    class ConstCaseError(ConstError):
        pass

    # 重写 __setattr__() 方法
    def __setattr__(self, name, value):
        if name in self.__dict__:
            raise self.ConstError("Can't change const {0}".format(name))
        if not name.isupper():
            raise self.ConstCaseError(
                "const name {0} is not all uppercase".format(name))
        self.__dict__[name] = value


const = _const()
# 默认的工程目录名称（顶层目录）
const.RUOYI_DEFAULT_PROJECT_DIR_NAME_TUPLE = ('RuoYi-fast', 'RuoYi-fast-master',
                                              'RuoYi-fast-Oracle',
                                              'RuoYi-fast-Oracle-master')
# 默认的artifactId
const.RUOYI_DEFAULT_ARTIFACTID_PREFIX = 'ruoyi'
# 默认的groupId
const.RUOYI_DEFAULT_GROUP_ID = 'com.ruoyi'
# 默认的包名
const.RUOYI_DEFAULT_PACKAGE_NAME = 'com.ruoyi'
# 默认的站点名称
const.RUOYI_DEFAULT_SITE_NAME = '若依管理系统'
# 默认的项目名称
const.RUOYI_DEFAULT_PROJECT_NAME = 'ruoyi'
# 需要修改站点名称的资源路径
const.RUOYI_SITE_RESOURCES_PATH_TUPLE = (
    'src#main#resources#templates#login.html',
    'src#main#resources#templates#index.html',
    'src#main#resources#templates#index-topnav.html',
    'src#main#resources#templates#main_v1.html',
    'src#main#resources#templates#register.html',
    'src#main#resources#templates#error#404.html',
    'src#main#resources#templates#error#500.html',
    'src#main#resources#templates#error#business.html',
    'src#main#resources#templates#error#unauth.html')
# 将系统加载的模块列表中的 constant 替换为 _const() 实例
sys.modules[__name__] = const